/*
 * @Date         : 2022-02-21 10:03:21
 * @LastEditors  : zu1662
 * @LastEditTime : 2022-03-04 09:27:02
 * @Description  : Router Main View
 * 
 * Copyright © 2022 by zu1662, All Rights Reserved. 
 */
import { IRoute } from '@/types/router';
import { IconBell } from '@douyinfe/semi-icons';
import loadable from '@loadable/component'

import GoogleSvg from '@/icons/google.svg'

const HomePage = loadable(() => import(/* webpackChunkName:'Home' */'@/views/Home'))
const AboutPage = loadable(() => import(/* webpackChunkName:'About' */'@/views/About'))
const MarkdownPage = loadable(() => import(/* webpackChunkName:'MarkdownPage' */'@/views/Components/Markdown'))

// ！！组件的 Icon 请传入 svg 图标. svg 图标请放置在 icons 目录下

// 固定路由
export const staticRoutes: IRoute[] = [
  {
    path: '/',
    redirect: '/home',
    title: '首页',
    hidden: true
  },
  {
    path: '/home',
    auth: false,
    icon: IconBell,
    title: '首页',
    titleI18n: 'home',
    component: HomePage
  },
];

// 异步筛选路由
export const asyncRoutes: IRoute[] = [
  {
    path: '/components',
    redirect: '/components/markdown',
    icon: GoogleSvg,
    title: '组件',
    titleI18n: 'components',
    authCode: '',
    children: [
      {
        path: '/components/markdown',
        title: 'Markdown',
        titleI18n: 'markdown',
        authCode: '',
        component: MarkdownPage
      }
    ]
  },
  {
    path: '/nest',
    title: '路由嵌套',
    redirect: '/nest/nest-2',
    icon: GoogleSvg,
    children: [
      {
        path: '/nest/nest-1',
        title: '嵌套-1',
        redirect: '/nest/nest-1/nest-1-1',
        children: [
          {
            path: '/nest/nest-1/nest-1-1',
            title: '嵌套-1-1',
            component: HomePage
          },
        ]
      },
      {
        path: '/nest/nest-2',
        title: '嵌套-2',
        component: MarkdownPage
      },

    ]
  },
  {
    path: '/about',
    icon: GoogleSvg,
    title: '关于作者',
    titleI18n: 'about',
    authCode: '',
    component: AboutPage,
  },
];
